// import Cookies from 'js-cookie'
export default {
  namespaced: true,
  state: {
    // collapsed: true // 控制左侧菜单的收缩/展开
    collapsed: localStorage.getItem('collapsedState') === '0' || false
  },
  mutations: {
    TOGGLE_SIDEBAR (state) {
      state.collapsed = !state.collapsed
      // 本地保存用户上一次的状态
      if (state.collapsed) {
        console.log('11111')
        localStorage.setItem('collapsedState', 0)
      } else {
        localStorage.setItem('collapsedState', 1)
      }
      // console.log(typeof Cookies.get('collapsedState')) // 判断数据类型
    }
  },
  actions: {
    toggleSideBar ({ commit }) {
      commit('TOGGLE_SIDEBAR')
    }
  }
}
